<template>
  <div class="Collect">
    <div class="top">
      <span class="fh"><van-icon name="arrow-left" @click="fh" /></span>
      <span>确定订单</span>
    </div>
    <div class="mainCenter">
      <div>
        <van-cell
          center
          title="请添加地址"
          is-link
          to="/Address"
          class="cell"
        />
      </div>
      <div class="goods">
        <van-card
        v-for="item in goodsList"
        :key="item.proid"
          :num="item.num"
          :price="item.originprice"
          :title="item.proname"
          :thumb="item.img1"
        />
      </div>
    </div>
    <div class="footer"></div>
  </div>
</template>

<script>
import { Toast } from "vant";
export default {
  name: "Submit",
  data(){
    return {
        goodsList:[]
    }
  },
  methods: {
    fh() {
      this.$router.go(-1);
    },
    onAdd() {
      Toast("xx");
    },
  },
  created(){
    let time = this.$route.params.time
    // console.log('time: ', time);
    let token = localStorage.getItem("token");
    // console.log('token: ', token);
    let userid=localStorage.getItem("userid");
    // console.log('userid: ', userid);
    this.$service({
        method: "get",
        url:"/api/order/confirmOrder",
        headers:{ token},
        params:{
            userid,
            time
        }
    }).then(res=>{
        // console.log(res,"res");
        if(res.data.code==200){
           this.goodsList=res.data.data
        //    console.log('this.goodsList: ', this.goodsList);
        }
    })
  }
};
</script>

<style scoped>
* {
  margin: 0;
  padding: 0;
  list-style: none;
  text-decoration: none;
}
.Collect {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.mainCenter {
  flex: 1;
  overflow: auto;
}
.top {
  text-align: center;
  line-height: 3rem;
  border-bottom: 2px solid gray;
  position: relative;
  height: 3rem;
}
.fh {
  position: absolute;
  font-size: 20px;
  left: 1rem;
}
.cell {
  border-bottom: 8px solid rgba(128, 128, 128, 0.179);
  height: 3rem;
  padding-left: 0.8rem;
  padding-right: 0.8rem;
}
.goods{
    margin-top: 0.5rem;
}
</style>